<?
layout("/inc/layout.html",{title:sysTitle}){
?>
<div id="page-wrapper">
	<!--BEGIN TITLE & BREADCRUMB PAGE-->
	<div id="title-breadcrumb-option-demo" class="page-title-breadcrumb">
		<div class="page-header pull-left">
			<div class="page-title">自然语言处理</div>
		</div>
		<ol class="breadcrumb page-breadcrumb pull-left">
			<li><i class="fa fa-home"></i>&nbsp;<a href="main.html">首页</a>&nbsp;&nbsp;<i
				class="fa fa-angle-right"></i>&nbsp;&nbsp;</li>
			<li>自然语言处理&nbsp;&nbsp;<i class="fa fa-angle-right"></i>&nbsp;&nbsp;</li>
			<li class="active">实体识别</li>
		</ol>
		<div class="clearfix"></div>
	</div>
	<!--END TITLE & BREADCRUMB PAGE-->
	<!--BEGIN CONTENT-->
	<div class="page-content" style="margin-left:50px; margin-right:50px;">
		
		<img src="images/slide2.png" width="70%" height="100px;"/>
		
		<div class="row" style="margin-top: 10px;">
			
			<!-- <div class="col-lg-12" style="margin-top: 10px;"> -->
				<div class="form-group">
					<div class="col-md-12" style="text-align:center">
						<label for="inputPhone" class="control-label pull-left"><h4>待处理文本:</h4></label>
					</div>
					<div class="col-md-12">
						<textarea id="text" name="text" rows="8" class="form-control">刘定荣说一直以为自己是AB血型，因为大多数时候不太喜欢多话，更喜欢用行动来表达，这也是多年在实体制造业打拼锻炼出来的素养。但是只要涉及到自己现在创业的领域，刘定荣非常的健谈，思路清晰严谨，逻辑性很强，这种巨大的反差实际上并非来源于血型，因为前段时间新出生的女儿是 O型血，而老婆是A 型血，医生告诉他A型血和AB型血的父母是无法生出O型血的孩子，没办法他在医生的建议下第一次抽血查了自己的血型，结果是O型血，熊猫血型还让刘定荣特意发了微信朋友圈得瑟了一下。</textarea>
					</div>
				</div>
			<!-- </div> -->
			<div class="col-lg-12" style="margin-top: 10px;">
				<a href="#" onclick="submitForm();" class="btn btn-success pull-left">提交文本<i class="fa fa-rocket"></i></a>
			</div>
		</div>
		
		<div class="row" style="margin-top: 10px;">
			<div class="col-lg-12">
				<!-- <ul id="generalTab" class="nav nav-tabs ul-edit responsive">
					<li class="active"><a href="#dp-1" data-toggle="tab">词性标注</a></li>
					<li><a href="#dp-2" data-toggle="tab">基于词表标注</a></li>
					<li><a href="#dp-3" data-toggle="tab">实体识别</a></li>
					<li><a href="#dp-4" data-toggle="tab">依存句法分析</a></li>
					<li><a href="#dp-5" data-toggle="tab">自动摘要</a></li>
					<li><a href="#dp-6" data-toggle="tab">关键词提取</a></li>
					<li><a href="#dp-7" data-toggle="tab">语义联想</a></li>
				</ul> -->
				<div  class="tab-content responsive" style="min-height:300px">
					<div id="dp-3" class="tab-pane fade in active">
						<div class="row">
							<div class="col-lg-8" id="recHtml">
								<h4>结果集：</h4>
								<button type="button" class="btn" style="margin-bottom: 5px; background-color: #EEDFCC; border: 1px solid #EEDFCC;">数据为空！</button>
							</div>
							<div class="col-lg-4" id="recCategoryHtml">
								<h4>词表来源:</h4>
								<button type="button" class="btn" style="margin-bottom: 5px; background-color: #EEDFCC; border: 1px solid #EEDFCC;">数据为空！</button>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		
		

	</div>
	<!--END CONTENT-->
</div>

<link type="text/css" rel="stylesheet" href="static/dependency.css">

<script type="text/javascript" src="static/d3.min.js"></script>
<script type="text/javascript" src="static/lex.js"></script>
<script type="text/javascript" src="static/dependency.js"></script>

<SCRIPT type="text/javascript">

function submitForm() {
	var text = $("#text").val();
	if($.trim(text).length<1) {
		alert("请输入待处理文本");
		return false;
	}
	submitRecognizeEntity(text);
}
//实体识别
function submitRecognizeEntity(text) {
	/* var recognizeEntityText=title+key+digest+text; */
	$.ajax({
		type: "post",
		url: "nlp-demo-recognizeEntity.html",
		data: {
			"text": text
		},
		dataType: "json",
		success: function(data) {
			var recHtml = '<h4>结果集：</h4>';
			var recCategoryHtml = '<h4>词表来源:</h4>';
			if(data!=null && data!='') {
				 $(data[0].posTaggingList).each(function(i) {
					 recHtml += ' <button type="button" class="btn" style="margin-bottom: 5px; background-color: ' 
					 + data[0].posTaggingList[i].color + '; border: 1px solid ' + data[0].posTaggingList[i].color + ';">' 
					 + data[0].posTaggingList[i].word + '</button>';
			  		
			  	
			  	 });
			  	 
				  $(data[0].result).each(function(i) {
					 
			  		 recCategoryHtml += ' <button type="button" class="btn" style="margin-bottom: 5px; background-color: ' 
					 + data[0].result[i].color + '; border: 1px solid ' + data[0].result[i].color + ';">' 
					 + data[0].result[i].name + '</button>';
			  	
			  	 });
			}
			$("#recHtml").html(recHtml);
			$("#recCategoryHtml").html(recCategoryHtml);
			
		},
		error : function(data) {
			// alert("请求失败");
		}
	});
}
</SCRIPT>


<?} ?>

